package com.catmiao.ai.config;

import dev.langchain4j.community.model.dashscope.WanxImageModel;
import dev.langchain4j.model.chat.ChatModel;
import dev.langchain4j.model.openai.OpenAiChatModel;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.time.Duration;
import java.util.List;

@Configuration
public class LLMConfig {

    @Bean
    public ChatModel imageModel(){
        String apiKey = System.getenv("BAILIAN_API_KEY");

        return OpenAiChatModel.builder()
                .apiKey(apiKey)
                .modelName("qwen-vl-max")
                .baseUrl("https://dashscope.aliyuncs.com/compatible-mode/v1")
                .logResponses(true)
                .logRequests(true)
                .maxRetries(3) // 重试次数
                .build();
    }


    /**
     * 通义万像图片生成
     * @return
     */
    @Bean
    public WanxImageModel wanxImageModel(){
        String apiKey = System.getenv("BAILIAN_API_KEY");

        return WanxImageModel.builder()
                .apiKey(apiKey)
                .modelName("wan2.2-t2i-plus")
                .build();
    }
}
